import javax.xml.soap.Node;
import java.awt.List;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-05-21
 * Time: 14:29
 */
public class Test {
    public static boolean isSubsequence (String S, String T) {
        // write code here
//        Stack<Character> stack = new Stack<>();
//        Stack<Character> stack1 = new Stack<>();
//        for (char c:
//             S.toCharArray()) {
//            stack.push(c);
//        }
//        for (char c:
//             T.toCharArray()) {
//            stack1.push(c);
//        }
//        while (!stack.empty() && !stack1.empty()) {
//            if(stack.peek() == stack1.peek()) {
//                stack.pop();
//                stack1.pop();
//            } else {
//                stack1.pop();
//            }
//        }
//        if(stack.empty()) {
//            return true;
//        } else {
//            return false;
//        }


//        int lens = S.length();
//        int lent = T.length();
//        int i = 0;
//        int j = 0;
//        while (i < lens && j < lent) {
//            if(S.charAt(i) == T.charAt(j)) {
//                i++;
//                j++;
//            } else {
//                j++;
//            }
//        }
//        return i == lens;
        ArrayList<Character> arrayList = new ArrayList<>();
        for (char c:
             S.toCharArray()) {
            arrayList.add(c);
        }
        for (char c:
             T.toCharArray()) {
            if(arrayList.contains(c)) {
                arrayList.remove(c);
            }
        }
        if(arrayList.isEmpty()) {
            return true;
        }
        return false;
    }

    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String string = scanner.next();
        Stack<Character> stack = new Stack<>();
        for (char c:
             string.toCharArray()) {
            if(stack.empty()) {
                stack.push(c);
            } else {
                char t = stack.peek();
                if(t == c) {
                    stack.pop();
                } else {
                    stack.push(c);
                }
            }
        }
        if(stack.empty()) {
            System.out.println(0);
        } else {
            Stack<Character> stack1 = new Stack<>();
            while (!stack.empty()) {
                stack1.push(stack.pop());
            }
            while (!stack1.empty()) {
                System.out.print(stack1.pop());
            }
        }
    }

    public static void main(String[] args) {
        boolean t = isSubsequence("nowcoder", "nowcoder");
        System.out.println(t);

    }
}
